'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE ,UUID,TEXT} = app.Sequelize;
  var moment = require('moment');

  const fd_auth = app.model.define('fd_auth', {
    id: { type: UUID, primaryKey: true},
    name:STRING(10),//权限名称，
    code:STRING(10),//权限code，
    path:STRING(50),//权限请求路径
    remark: {type:STRING(200),comment:'备注'},//备注
    deleted:{type:STRING(1),defaultValue:'0'} ,//0:可用 ,1:不可用
    created_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('created_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    },
    updated_at: {
      type: DATE,
      get() {
        return moment(this.getDataValue('updated_at')).format('YYYY-MM-DD HH:mm:ss');
      }
    }
  },{freezeTableName: true,timestamps: true})

  return fd_auth;
};
